/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.Entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vi
 */
@Entity
@Table(name = "employee_languages")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmployeeLanguages.findAll", query = "SELECT e FROM EmployeeLanguages e"),
    @NamedQuery(name = "EmployeeLanguages.findById", query = "SELECT e FROM EmployeeLanguages e WHERE e.id = :id"),
    @NamedQuery(name = "EmployeeLanguages.findByLevel", query = "SELECT e FROM EmployeeLanguages e WHERE e.level = :level")})
public class EmployeeLanguages implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 3)
    @Column(name = "level")
    private String level;
    @JoinColumn(name = "id_language", referencedColumnName = "id_language")
    @ManyToOne
    private Language idLanguage;
    @JoinColumn(name = "id_employee", referencedColumnName = "id_employee")
    @ManyToOne
    private Employee idEmployee;

    public EmployeeLanguages() {
    }

    public EmployeeLanguages(String level, Language idLanguage, Employee idEmployee) {
        this.level = level;
        this.idLanguage = idLanguage;
        this.idEmployee = idEmployee;
    }
    
    

    public EmployeeLanguages(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public Language getIdLanguage() {
        return idLanguage;
    }

    public void setIdLanguage(Language idLanguage) {
        this.idLanguage = idLanguage;
    }

    public Employee getIdEmployee() {
        return idEmployee;
    }

    public void setIdEmployee(Employee idEmployee) {
        this.idEmployee = idEmployee;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmployeeLanguages)) {
            return false;
        }
        EmployeeLanguages other = (EmployeeLanguages) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.Entity.EmployeeLanguages[ id=" + id + " ]";
    }
    
}
